home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3273 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1016 b 

  1. Path: news.cencom.net!netnews
  2. From: wsenn@cencom.net (Will Senn)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: getch() and cin
  5. Date: 22 Jan 1996 16:05:04 GMT
  6. Organization: Your Organization
  7. Message-ID: <4e0cjg$5rb@news.cencom.net>
  8. References: <4dncee$4g2@news.cencom.net> <4dnk7i$36ha@holly.ACNS.ColoState.EDU>
  9. NNTP-Posting-Host: macomb_ppp__04.cencom.net
  10. Mime-Version: 1.0
  11. Content-Type: Text/Plain; charset=US-ASCII
  12. X-Newsreader: WinVN 0.99.7
  13.  
  14. >void main()
  15. >{
  16. >  char Temp;
  17. >
  18. >  cin.get(Temp);
  19. >  while(Temp != '\n') cin.get(Temp);
  20. >
  21. >  return;
  22. >}
  23. >-------------------------------------
  24. >
  25. >This will read a character at a time until the newline.  The get() 
  26. >member is what you want.  Questions?
  27.  
  28. Thanks, but what I need to know is how to read one character, be able to use
  29. that character, and NOT have to wait for the newline. i.e. The program
  30. prompts for input INPUT: , the user presses 'a', the program parses the 'a'
  31. to see if it is a 'c' then does whatever I want next.  Definately not:
  32. INPUT: "a\n"
  33.  
  34. Thanks,
  35. Will  
  36.  
  37.